/**
 * 
 */
package com.nandasoft.njurep.substance.dao.impl;

import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Repository;

import com.nandasoft.njuerp.common.dao.BaseDao;
import com.nandasoft.njurep.substance.bean.WareStateBean;
import com.nandasoft.njurep.substance.dao.WareStateDao;

/**
 * @title
 * @author Administrator
 * @date 2016年10月7日 下午1:57:33
 */
@Repository("wareStateDao")
public class WareStateDaoImpl extends BaseDao<WareStateBean> implements WareStateDao {

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.nandasoft.njurep.substance.dao.WareStateDao#insertWareStateInfo(com.
	 * nandasoft.njurep.substance.bean.WareStateBean)
	 */
	@Override
	public void insertWareStateInfo(WareStateBean bean) {
		// TODO Auto-generated method stub
		String sql = "insert into T_WARE_STATE values (:id,:partCode,:wareCode,:staCode,:oriNum,:oriSum0,:oriSum1,"
				+ ":inNum,:inSum0,:inSum1,:feeSum0,:feeSum1,:outNum,:outSum0,:outSum1,:adjNum,:adjSum0,"
				+ ":adjSum1,:curNum,:curSum2,:curSum,:curMaPrice0,:curMaPrice1,:createdby,:ctime,:updatedby,:utime)";
		SqlParameterSource paramSource = new BeanPropertySqlParameterSource(bean);
		insert(sql, paramSource);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.nandasoft.njurep.substance.dao.WareStateDao#updateWareStateInfo(com.
	 * nandasoft.njurep.substance.bean.WareStateBean)
	 */
	@Override
	public void updateWareStateInfo(WareStateBean bean) {
		// TODO Auto-generated method stub
		String sql = "update T_WARE_STATE set ORI_NUM= :oriNum,ORI_SUM0= :oriSum0,ORI_SUM1= :riSum1,IN_NUM = :inNum,"
				+ " IN_SUM0= :inSum0,IN_SUM1= :inSum1,FEE_SUM0= :feeSum0,FEE_SUM1= :feeSum1,OUT_NUM= :outNum, "
				+ " OUT_SUM0= :outSum0,OUT_SUM1= :outSum1,ADJ_NUM= :adjNum,ADJ_SUM0= :adjSum0,ADJ_SUM1= :adjSum1,"
				+ " CUR_NUM= :curNum,CUR_SUM2= :curSum2,CUR_SUM= :curSum,CUR_MA_PRICE0 = :curMaPrice0,"
				+ " CUR_MA_PRICE1 = :curMaPrice1,UPDATEDBY = :updatedby,UTIME  = :utime where id = :id";
		SqlParameterSource paramSource = new BeanPropertySqlParameterSource(bean);
		update(sql, paramSource);
	}

}
